package interview;

import lombok.val;

import java.math.BigDecimal;
import java.time.Duration;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.LongStream;

/**
 * @Author: zhangrongqing
 * @Date: 2019/11/11 16:15
 */
public class TestCase {
    public static void main(String[] args) {

//        Collections.synchronizedList(new ArrayList<>());
//        Instant start = Instant.now();
//        System.out.println(LongStream.rangeClosed(1L,50000000L).parallel().reduce(0L,Long::sum));
//        Instant end = Instant.now();
//        System.out.println(Duration.between(start,end).toMillis());
//
//
//        Instant start1 = Instant.now();
//        System.out.println(LongStream.rangeClosed(1L,50000000L).reduce(0L,Long::sum));
//        Instant end1 = Instant.now();
//        System.out.println(Duration.between(start1,end1).toMillis());


        List<BigDecimal> list = new ArrayList();
        list.add(null);
        BigDecimal reduce = list.stream().filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
        System.out.println(reduce);
    }
}
